﻿using IEVin.PropertyChangedNotificator;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Text;
using System.Threading;

namespace PropertyChangedNotificator.Test
{
    public abstract class NotVirtualModelBase : NotificationObject
    {


        private static readonly ConcurrentDictionary<string, AutoResetEvent> ResetEventSource = new ConcurrentDictionary<string, AutoResetEvent>();
        private AutoResetEvent autoResetEvent;


        public NotVirtualModelBase()
        {
        }

        private void BaseSagaData_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {


            var propertynfo = GetType().GetProperty(e.PropertyName, BindingFlags.Public | BindingFlags.Instance);
            _ = bool.TryParse(propertynfo.GetValue(sender).ToString(), out var proValue);
            Console.WriteLine("======================================================================");
            Console.WriteLine($"{e.PropertyName}=={proValue}");
            Console.WriteLine("======================================================================");

        }
        private string sagaId { get; set; }

        public string SagaId
        {
            get => sagaId;
            set
            {
                this.sagaId = value;
                this.PropertyChanged+= BaseSagaData_PropertyChanged;

            }
        }
        public abstract bool IsDone();



    }
}
